//
//  RegularType.swift
//  PigManager
//
//  Created by 邱仙凯 on 2020/9/22.
//  Copyright © 2020 Much. All rights reserved.
//

import Foundation
// 正则类型
public struct RegularType {

    // 大写字母 小写字母 数字 特殊字符，四种包括三种，长度8~30
    public static let password_pattern = "^(?![a-zA-Z]+$)(?![A-Z0-9]+$)(?![A-Z\\W_]+$)(?![a-z0-9]+$)(?![a-z\\W_]+$)(?![0-9\\W_]+$)[a-zA-Z0-9\\W_]{8,30}$"
    
    public static let mail_pattern = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)*$"

    // 特殊符号
    public static let Char_pattern = "[`~!@#$%^&*()+=|{}':;',\\[\\].<>/?~！@#￥%……&*（）——+|{}【】‘；：”“’。，、？]"
    
    // 注册页面密码限制
    public static let Char_pattern50 = "^s*([0-9a-zA-Z]{1,50})s*$"
    
    
    //        "^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{8,16}$" 数字字母混合输入
    public static let p = "^(?=.{8,}$)(?=.*\\d)(?=.*\\W+)(?=.*[A-Z])(?=.*[a-z])(?!.*\n).*$"
    
    /*
     (?!^\d+$)  排除全数字
     (?!^[a-zA-Z]+$) 排除全字母
     [0-9a-zA-Z]{4,23} 字符或字母4-23位，不考虑全为数字和全为字符情况。
     */
    
    // 银行卡 持卡人(英文字母) 年月 cvv 日期(日月年) 时间(时分) 四位整数 8位整数两位小数
    public static let cardNumber_pattern = "^(\\d{4}(?: )){3}\\d{4}$"
    
    public static let cardholder_pattern = "^[a-zA-Z ]{3,}$"
    public static let validUntil_pattern = "^(1[0-2]|(?:0)[1-9])(?:/)\\d{2}$"
    public static let cvv_pattern = "^\\d{3}$"
    public static let date_pattern = "^(3[0-1]|[1-2][0-9]|(?:0)[1-9])(?:\\.)(1[0-2]|(?:0)[1-9])(?:\\.)[1-9][0-9]{3}$"
    public static let time_pattern = "^(2[0-3]|1[0-9]|(?:0)[0-9])(?::)([0-5][0-9])$"
    
    // 3位整数
    public static let intNum_pattern3 = "^s*([0-9]|[1-9][0-9]{1,2})s*$"
    // 4位整数
    public static let intNum_pattern = "^s*([0-9]|[1-9][0-9]{1,3})s*$"
    // 6位整数
    public static let intNum_pattern6 = "^s*([0-9]|[1-9][0-9]{1,5})s*$"
    // 8位整数
    public static let intNum_pattern8 = "^s*([0-9]|[1-9][0-9]{1,7})s*$"
    
    // 10位整数2位小数
    public static let doubleNum_pattern10_2 = "^s*(([0-9]|[1-9][0-9]{1,9})|(([0-9]|[1-9][0-9]{1,7})(?:\\.)[0-9]{1,2}))s*$"
    
    // 8位整数2位小数
    public static let doubleNum_pattern = "^s*(([0-9]|[1-9][0-9]{1,7})|(([0-9]|[1-9][0-9]{1,7})(?:\\.)[0-9]{1,2}))s*$"
    
    // 6位整数4位小数
    public static let doubleNum_pattern6_4 = "^s*(([0-9]|[1-9][0-9]{1,5})|(([0-9]|[1-9][0-9]{1,5})(?:\\.)[0-9]{1,4}))s*$"
    
    // 6位整数2位小数
    public static let doubleNum_pattern6 = "^s*(([0-9]|[1-9][0-9]{1,5})|(([0-9]|[1-9][0-9]{1,5})(?:\\.)[0-9]{1,2}))s*$"
    
    // 4位整数2位小数
    public static let doubleNum_pattern4 = "^s*(([0-9]|[1-9][0-9]{1,3})|(([0-9]|[1-9][0-9]{1,3})(?:\\.)[0-9]{1,2}))s*$"
    
    // 3位整数2位小数
    public static let doubleNum_pattern3 = "^s*(([0-9]|[1-9][0-9]{1,2})|(([0-9]|[1-9][0-9]{1,2})(?:\\.)[0-9]{1,2}))s*$"
    
}
